<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对话中 - 智能软件测试助手</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #E60027;
            --primary-light: #fff1f0;
            --bg-color: #f5f7fa;
            --sidebar-width: 260px;
            --text-dark: #333;
            --text-gray: #666;
            --border-color: #eee;
            --chat-bg: #fff;
            --code-bg: #2d2d2d;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }

        body { background-color: var(--bg-color); display: flex; height: 100vh; overflow: hidden; }

        /* --- 侧边栏 (保持一致，但填充了数据) --- */
        .sidebar {
            width: var(--sidebar-width);
            background: white;
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            padding: 24px 20px;
            height: 100%;
            flex-shrink: 0;
        }

        .user-profile {
            display: flex;
            align-items: center;
            padding-bottom: 24px;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 10px;
        }

        .avatar {
            width: 46px; height: 46px; background: #ff3b56; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            color: white; font-size: 24px; margin-right: 12px; flex-shrink: 0;
        }

        .user-info h3 { font-size: 16px; font-weight: 600; color: var(--text-dark); }
        .role-tag { font-size: 11px; color: var(--primary-color); background: #ffeef1; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
        .company-name { font-size: 12px; color: var(--text-gray); }

        .history-section { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
        .section-header { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #999; margin: 15px 0 10px; }

        /* 历史记录列表项 */
        .history-item {
            padding: 10px 12px;
            margin-bottom: 5px;
            border-radius: 6px;
            cursor: pointer;
            color: var(--text-dark);
            font-size: 14px;
            display: flex;
            align-items: center;
            transition: all 0.2s;
            text-decoration: none;
        }

        .history-item i { margin-right: 10px; color: #aaa; font-size: 14px; }

        .history-item:hover { background-color: #f5f5f5; }

        /* 选中状态 */
        .history-item.active { background-color: var(--primary-light); color: var(--primary-color); }
        .history-item.active i { color: var(--primary-color); }
        .history-item .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

        .sidebar-actions { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: 10px;}
        .menu-btn { width: 100%; background: none; border: none; text-align: left; padding: 12px 10px; color: #444; font-size: 14px; cursor: pointer; border-radius: 6px; display: flex; align-items: center; }
        .menu-btn i { width: 24px; color: #666; margin-right: 8px; }
        .menu-btn:hover { background-color: #f5f5f5; }

        /* --- 主聊天区域 --- */
        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--bg-color);
            position: relative;
        }

        /* 顶部标题栏 */
        .chat-header {
            height: 60px;
            background: white;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 30px;
            flex-shrink: 0;
        }

        .chat-title { font-size: 16px; font-weight: 600; color: var(--text-dark); display: flex; align-items: center; gap: 10px; }
        .status-dot { width: 8px; height: 8px; background: #52c41a; border-radius: 50%; } /* 在线状态 */

        .header-actions button {
            background: none; border: 1px solid #ddd; padding: 6px 12px; border-radius: 4px; cursor: pointer; color: var(--text-gray); font-size: 12px; margin-left: 10px; transition: all 0.2s;
        }
        .header-actions button:hover { border-color: var(--primary-color); color: var(--primary-color); }

        /* 消息滚动区 */
        .messages-area {
            flex: 1;
            overflow-y: auto;
            padding: 30px;
            display: flex;
            flex-direction: column;
            gap: 24px;
            scroll-behavior: smooth;
        }

        /* 消息气泡通用样式 */
        .message { display: flex; gap: 16px; max-width: 90%; }
        .message.user { align-self: flex-end; flex-direction: row-reverse; }

        .msg-avatar {
            width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center; font-size: 18px; color: white;
        }
        .ai-avatar { background: linear-gradient(135deg, #E60027, #ff6b6b); }
        .user-avatar { background: #333; }

        .msg-content {
            background: white;
            padding: 16px;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.04);
            font-size: 15px;
            line-height: 1.6;
            color: var(--text-dark);
            position: relative;
            min-width: 200px;
        }

        /* 用户消息气泡 */
        .message.user .msg-content {
            background: var(--primary-color);
            color: white;
            border-radius: 12px 0 12px 12px;
        }

        /* AI 消息气泡 */
        .message.ai .msg-content {
            border-radius: 0 12px 12px 12px;
            background: white;
        }

        /* AI 回复中的特殊元素样式 (Markdown 渲染模拟) */

        /* 表格样式 (测试用例) */
        .msg-content table {
            width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px;
        }
        .msg-content th, .msg-content td {
            border: 1px solid #eee; padding: 8px 12px; text-align: left;
        }
        .msg-content th { background: #fafafa; color: #666; font-weight: 600; }
        .msg-content tr:hover { background: #fdfdfd; }

        /* 代码块样式 */
        .code-block {
            background: #282c34;
            border-radius: 6px;
            margin: 10px 0;
            overflow: hidden;
            font-family: 'Consolas', monospace;
        }
        .code-header {
            background: #21252b;
            padding: 6px 12px;
            color: #abb2bf;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
        }
        .code-content {
            padding: 12px;
            color: #e5c07b; /* 模拟代码高亮颜色 */
            font-size: 13px;
            overflow-x: auto;
            white-space: pre;
        }
        .code-keyword { color: #c678dd; } /* 紫色关键字 */
        .code-string { color: #98c379; } /* 绿色字符串 */

        /* 底部输入框 */
        .input-wrapper {
            background: white;
            padding: 20px 30px;
            border-top: 1px solid var(--border-color);
        }

        .input-box {
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 10px;
            background: white;
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
        }
        .input-box:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(230, 0, 39, 0.1); }

        textarea {
            width: 100%; height: 60px; border: none; resize: none; outline: none; font-size: 15px; color: #333; margin-bottom: 10px;
        }

        .input-actions { display: flex; justify-content: space-between; align-items: center; }

        .toolbar { display: flex; gap: 15px; color: #999; }
        .toolbar i { cursor: pointer; font-size: 16px; transition: color 0.2s; }
        .toolbar i:hover { color: var(--text-dark); }

        .btn-send {
            background: var(--primary-color); color: white; border: none; padding: 8px 20px; border-radius: 4px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 6px;
        }
        .btn-send:hover { background: #c40022; }

    </style>
</head>
<body>

    <!-- 侧边栏 -->
    <aside class="sidebar">
        <div class="user-profile">
            <div class="avatar"><i class="fa-solid fa-robot"></i></div>
            <div class="user-info">
                <h3>Maynorai1 <span class="role-tag">User</span></h3>
                <p class="company-name">Chinaunicom Software</p>
            </div>
        </div>

        <div class="history-section">
            <div class="section-header">
                <span>最近对话</span>
            </div>

            <!-- 激活状态的 Item -->
            <div class="history-item active">
                <i class="fa-regular fa-comment-dots"></i>
                <span class="title">登录模块功能测试</span>
            </div>

            <!-- 普通 Item -->
            <div class="history-item">
                <i class="fa-regular fa-comment"></i>
                <span class="title">支付接口压力测试脚本</span>
            </div>
            <div class="history-item">
                <i class="fa-regular fa-comment"></i>
                <span class="title">用户管理 UI 自动化</span>
            </div>
             <div class="history-item">
                <i class="fa-regular fa-comment"></i>
                <span class="title">CRM 系统回归测试计划</span>
            </div>
        </div>

        <div class="sidebar-actions">
            <button class="menu-btn"><i class="fa-solid fa-file-arrow-down"></i> 下载全部报告</button>
            <button class="menu-btn"><i class="fa-solid fa-chart-pie"></i> 下载报告统计</button>
            <button class="menu-btn"><i class="fa-solid fa-trash-can"></i> 清空历史</button>
        </div>
    </aside>

    <!-- 主聊天界面 -->
    <main class="chat-container">

        <!-- 头部 -->
        <header class="chat-header">
            <div class="chat-title">
                <span class="status-dot"></span>
                登录模块功能测试
            </div>
            <div class="header-actions">
                <button><i class="fa-solid fa-download"></i> 导出对话</button>
                <button><i class="fa-solid fa-rotate-right"></i> 重置</button>
            </div>
        </header>

        <!-- 消息列表 -->
        <div class="messages-area">

            <!-- 用户消息 1 -->
            <div class="message user">
                <div class="msg-avatar user-avatar"><i class="fa-solid fa-user"></i></div>
                <div class="msg-content">
                    请帮我生成针对登录页面的功能测试用例，需要包含异常场景。
                </div>
            </div>

            <!-- AI 回复 1 -->
            <div class="message ai">
                <div class="msg-avatar ai-avatar"><i class="fa-solid fa-robot"></i></div>
                <div class="msg-content">
                    <p>好的，已为您生成登录模块的功能测试用例，包含正常登录及常见的异常场景：</p>
                    <br>
                    <!-- 模拟表格 -->
                    <table>
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>测试场景</th>
                                <th>前置条件</th>
                                <th>预期结果</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>TC_001</td>
                                <td>正确用户名密码登录</td>
                                <td>账号已注册</td>
                                <td>跳转至首页</td>
                            </tr>
                            <tr>
                                <td>TC_002</td>
                                <td>密码为空提交</td>
                                <td>访问登录页</td>
                                <td>提示“请输入密码”</td>
                            </tr>
                            <tr>
                                <td>TC_003</td>
                                <td>账号不存在</td>
                                <td>输入未注册账号</td>
                                <td>提示“账号或密码错误”</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>

            <!-- 用户消息 2 -->
            <div class="message user">
                <div class="msg-avatar user-avatar"><i class="fa-solid fa-user"></i></div>
                <div class="msg-content">
                    这很好，请用 Python Selenium 写一个自动化脚本来执行 TC_001。
                </div>
            </div>

            <!-- AI 回复 2 (带代码) -->
            <div class="message ai">
                <div class="msg-avatar ai-avatar"><i class="fa-solid fa-robot"></i></div>
                <div class="msg-content">
                    <p>基于 Selenium 的自动化测试脚本如下：</p>

                    <!-- 模拟代码块 -->
                    <div class="code-block">
                        <div class="code-header">
                            <span>python</span>
                            <span style="cursor:pointer"><i class="fa-regular fa-copy"></i> Copy</span>
                        </div>
                        <div class="code-content">
<span class="code-keyword">from</span> selenium <span class="code-keyword">import</span> webdriver
<span class="code-keyword">from</span> selenium.webdriver.common.by <span class="code-keyword">import</span> By
<span class="code-keyword">import</span> time

<span class="code-string"># 初始化浏览器</span>
driver = webdriver.Chrome()
driver.get(<span class="code-string">"http://example.com/login"</span>)

<span class="code-string"># 定位元素并输入</span>
driver.find_element(By.ID, <span class="code-string">"username"</span>).send_keys(<span class="code-string">"admin"</span>)
driver.find_element(By.ID, <span class="code-string">"password"</span>).send_keys(<span class="code-string">"123456"</span>)

<span class="code-string"># 点击登录</span>
driver.find_element(By.ID, <span class="code-string">"btn-login"</span>).click()

<span class="code-string"># 断言验证</span>
time.sleep(2)
<span class="code-keyword">assert</span> <span class="code-string">"dashboard"</span> <span class="code-keyword">in</span> driver.current_url
print(<span class="code-string">"TC_001 Passed"</span>)
                        </div>
                    </div>
                </div>
            </div>

        </div>

        <!-- 底部输入区 -->
        <div class="input-wrapper">
            <div class="input-box">
                <textarea placeholder="输入您的指令，支持 Shift + Enter 换行..."></textarea>
                <div class="input-actions">
                    <div class="toolbar">
                        <i class="fa-solid fa-paperclip" title="上传附件"></i>
                        <i class="fa-solid fa-image" title="上传图片"></i>
                        <i class="fa-solid fa-microphone" title="语音输入"></i>
                    </div>
                    <button class="btn-send">
                        发送 <i class="fa-solid fa-paper-plane"></i>
                    </button>
                </div>
            </div>
            <div style="text-align: center; color: #999; font-size: 12px; margin-top: 10px;">
                AI 生成内容仅供参考，请以实际测试环境为准。
            </div>
        </div>

    </main>

</body>
</html>
